package game;
import java.awt.Graphics2D;
import java.awt.Color;

public class SprBall {
	int x = 0;
	int y = 0;
	int xa = 1;
	int ya = 1;
	private Game game;

	public SprBall(Game game) {
		this.game= game;
	}

	void move() {
		if (x + xa < 0)
			xa = 1;
		if (x + xa > game.getWidth() - 30)
			xa = -1;
		if (y + ya < 0)
			ya = 1;
		if (y + ya > game.getHeight() - 30)
			ya = -1;
	/*	if (collision()){
			ya = -1;
		//	y = game.racquet.getTopx() - 30;
			//x = game.racquet1.getTopy() - 30;
		}
		if (collision1()){
			ya = -1;
			//y = game.racquet.getTopx() - 30;
			//x = game.racquet1.getTopy() - 30;
		}*/

		x = x + xa;
		y = y + ya;
	}
	
/*	private boolean collision1() {
		return game.racquet1.getBounds().intersects(getBounds());
		}

	private boolean collision() {
		return game.racquet.getBounds().intersects(getBounds());
		}
	public Rectangle getBounds() {
		return new Rectangle(x, y, 30, 30);
	}*/
	public void paint(Graphics2D g) {
		g.fillOval(x, y, 30, 30);
		g.setColor(Color.YELLOW);
		
	}
}
